package com.clw.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import com.clw.bean.Shishitongji;
import db_Util.ConnectHelper;

public class ShishitongjiDao {
	public ArrayList<Shishitongji>  query() {
		ArrayList<Shishitongji> shishitongjiArr = new ArrayList<Shishitongji>();
		ConnectHelper ch = new ConnectHelper();
		Connection conn = ch.openConnection();
		try {
			PreparedStatement ps = conn.prepareStatement("select * from t_shishitongji");
			ResultSet rs = ps.executeQuery();
			while (rs.next()) {
				Shishitongji shishitongji = new Shishitongji();
				shishitongji.setZongshu(rs.getInt("zongshu"));
				shishitongji.setZaixianshu(rs.getInt("zaixianshu"));
				shishitongji.setHuoyueshu(rs.getInt("huoyueshu"));
				shishitongji.setHuoyuelv(rs.getString("huoyuelv"));
				shishitongjiArr.add(shishitongji);
				
			}
			conn.close();
		} catch (SQLException e) {
			e.printStackTrace();
		} 
		
		return shishitongjiArr;
	}
	

}
